<?php
/**
 * Created by PhpStorm.
 * User: zeopean
 * Date: 2015/8/21
 * Time: 14:55
 */

namespace App\Exceptions;

use Exception ;

class TagsException extends Exception{

    /**
     * TagExists            标签已经存在
     * TagNull              标签不存在
     */
    const TagExists = 0x01;
    const TagNull   = 0x02;

    public function __construct($code, array $data = [], Exception $previous = null)
    {
        switch ($code) {
            case self::TagExists:
                $message = trans('exception.tagsRelations.tag_exists');
                break;
            case self::TagNull:
                $message = trans('exception.tags.is-null');
                break;

            default:
                $message = trans('general.unknown_exception');
                break;
        }

        parent::__construct($message, $code, $previous);
    }

}